import { getItem, setItem } from '@/utils/storage'
import { MAIN_COLOR, DEFAULT_COLOR } from '@/constant/index'
import variables from '@/styles/variables.module.scss'
export default {
  namespaced: true, // 设置为单独模块
  state: () => ({
    mainColor: getItem(MAIN_COLOR) || DEFAULT_COLOR,
    variables
  }),
  actions: {},
  mutations: {
    setMainColor(state, mainColor) {
      state.mainColor = mainColor
      setItem(MAIN_COLOR, mainColor)
      state.variables.menuBg = mainColor
      console.log('设置成功', mainColor)
    }
  }
}
